// @algorithm @lc id=100285 lang=cpp
// @title jian-sheng-zi-ii-lcof

#include "algm/algm.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
    // @test(120)=953271190
public:
    int cuttingRope(int n) {
        long ans = 1;
        if (n < 2) {
            return 0;
        }
        if (n == 2) {
            return 1;
        }
        if (n == 3) {
            return 2;
        }
        int timesOf3 = n / 3;
        if (n - timesOf3 * 3 == 1) {
            timesOf3 -= 1;
        }
        int timesOf2 = (n - timesOf3 * 3) / 2;
        while (timesOf3) {
            ans = ans * 3 % 1000000007;
            --timesOf3;
        }
        while (timesOf2) {
            ans = ans * 2 % 1000000007;
            --timesOf2;
        }
        return (int)ans;
    }
};